//Erstellt von Moritz Liepe
package main.simulation;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.ui.AbstractSourceProvider;
import org.eclipse.ui.ISources;

public class RunStateProvider extends AbstractSourceProvider 
{
	public final static String RUN_STATE = "main.simulation.runState";
	
	public final static String STATE_PLAY = "play";
	public final static String STATE_STOP = "stop";
	
	private String currentRunState = "";

	@Override
	public void dispose() {}

	@Override
	public Map<String, String> getCurrentState() 
	{
		Map<String, String> currentStateMap = new HashMap<String, String>(1);
		String currentState = currentRunState;
		currentStateMap.put(RUN_STATE, currentState);
		return currentStateMap;
	}

	@Override
	public String[] getProvidedSourceNames() 
	{
		return new String[] {RUN_STATE};
	}

	public String getCurrentRunState() 
	{
		return currentRunState;
	}

	public void setCurrentRunState(String currentRunState) 
	{
		if(this.currentRunState.equals(currentRunState))
		{
			return; //No change
		}
		this.currentRunState = currentRunState;
		fireSourceChanged(ISources.WORKBENCH, RUN_STATE,this.currentRunState);
		
	}
	
	

}
